from piercing.pierc_common import InclineWellForceParams
import math


# 直井最大安全拉力计算

def get_maximum_inclineforce(params: InclineWellForceParams) -> float:
    # 电缆的单位密度
    rho_cable: float = (params.cable_mass_per_km / 1000) / (math.pi / 4 * (params.cable_diameter_mm * 0.001) ** 2)
    # 电缆在液体中的单位密度
    rho_o1: float = rho_cable - params.rho_liud
    # 电缆的截面积
    a_cable = math.pi / 4 * (params.cable_diameter_mm * 0.001) ** 2
    # 电缆在液体中的单位质量
    m_cable = rho_o1 * a_cable

    # 拉力棒的拉力转换为牛顿
    f_pullrod_N: float = params.F_pullrod_ibf * 4.45
    # 将倾斜角度从度转换为弧度
    incline_radians = math.radians(params.incline_degree)
    # 最大安全拉力
    F_safe_max : float= ((params.well_depth_m * m_cable * 9.81 + f_pullrod_N) * math.cos(incline_radians)) / 1000
    return F_safe_max

if __name__ == '__main__':
    params = InclineWellForceParams()
    params.well_depth_m = 5000
    params.incline_degree = 20
    params.F_pullrod_ibf = 10000
    params.rho_liud = 1300
    params.cable_diameter_mm = 11.8
    params.cable_mass_per_km = 508
    F_safe_max = get_maximum_inclineforce(params)
    print(F_safe_max)



